package com.Java.train.business.controller;

import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class TestBusinessController {
    private static final Logger LOG = LoggerFactory.getLogger(TestBusinessController.class);
    @Value("${test.cacos}")
    private String cacos;

    @Value("${spring.application.name}")
    private String name;

    @SneakyThrows
    @GetMapping("/hello")
    public String cacos() {
        LOG.info("获取值为：{}", cacos);
        Thread.sleep(500);
        return String.format("Hello %s!, %s", cacos, name);
    }

}
